home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / et / et3_0-a1.lha / et3 / src / LOOKS / EtLook.C next >
C/C++ Source or Header  |  1992-07-06  |  18KB  |  682 lines

  1. #ifdef __GNUG__
  2. #pragma implementation
  3. #endif
  4.  
  5. #include "EtLook.h"
  6.  
  7. #include "Env.h"
  8. #include "WindowSystem.h"
  9. #include "Expander.h"
  10. #include "Buttons.h"
  11. #include "Layout.h"
  12. #include "Math.h"
  13.  
  14. static u_short UpArrowBits[]= {
  15. #   include "images/UpArrow.image"
  16. };
  17. static u_short InvUpArrowBits[]= {
  18. #   include "images/UpArrowInv.image"
  19. };
  20. static u_short DownArrowBits[]= {
  21. #   include "images/DownArrow.image"
  22. };
  23. static u_short InvDownArrowBits[]= {
  24. #   include "images/DownArrowInv.image"
  25. };
  26. static u_short LeftArrowBits[]= {
  27. #   include "images/LeftArrow.image"
  28. };
  29. static u_short InvLeftArrowBits[]= {
  30. #   include "images/LeftArrowInv.image"
  31. };
  32. static u_short RightArrowBits[]= {
  33. #   include "images/RightArrow.image"
  34. };
  35. static u_short InvRightArrowBits[]= {
  36. #   include "images/RightArrowInv.image"
  37. };
  38. static u_short menuArrowBits[]= {
  39. #   include "images/menuarrow.image"
  40. };
  41. static u_short RadioButtonOnBits[]= {
  42. #   include "images/RadioButtonOn.image"
  43. };
  44. static u_short RadioButtonOffBits[]= {
  45. #   include "images/RadioButtonOff.image"
  46. };
  47. static u_short RadioButtonFeedbackBits[]= {
  48. #   include "images/RadioButtonFeedback.image"
  49. };
  50. static u_short CheckMarkOnBits[]= {
  51. #   include "images/CheckmarkOn.image"
  52. };
  53. static u_short CheckMarkOffBits[]= {
  54. #   include "images/CheckmarkOff.image"
  55. };
  56. static u_short CheckMarkFeedbackBits[]= {
  57. #   include "images/CheckmarkInv.image"
  58. };
  59. static u_short CheckMarkBits[]= {
  60. #   include "images/Checkmark.image"
  61. };
  62. static u_short StretchBoxNEBits[]= {
  63. #   include "images/StretchBoxNE.image"
  64. };
  65. static u_short StretchBoxNWBits[]= {
  66. #   include "images/StretchBoxNW.image"
  67. };
  68. static u_short StretchBoxSEBits[]= {
  69. #   include "images/StretchBoxSE.image"
  70. };
  71. static u_short StretchBoxSWBits[]= {
  72. #   include "images/StretchBoxSW.image"
  73. };
  74.  
  75. //---- ETLook ------------------------------------------------------------------
  76.  
  77. ETLook *gET;
  78.  
  79. Look *MakeEtLook()
  80. {
  81.     return new ETLook;
  82. }
  83.  
  84. //---- ETMenuBorderLayout ------------------------------------------------------
  85.  
  86. class ETMenuBorderLayout : public Layout {
  87.     int shadow;
  88. public:
  89.     ETMenuBorderLayout(int shad)
  90.     { shadow= shad; }
  91.     void SetOrigin(VObject*, Point);
  92.     void SetExtent(VObject*, Point);
  93.     Metric GetMinSize(VObject *acv);
  94.     void Adorn(VObject *acv, Rectangle &r, int code);
  95. };
  96.  
  97. Metric ETMenuBorderLayout::GetMinSize(VObject *acv)
  98. {
  99.     Point e= acv->At(0)->GetMinSize().extent + 2*gPoint2 + shadow;
  100.     if (acv->Size() > 1) {
  101.     Metric tm= acv->At(1)->GetMinSize();
  102.     e.x= Math::Max(e.x, tm.extent.x);
  103.     e.y+= tm.extent.y;
  104.     }
  105.     return e;
  106. }
  107.  
  108. void ETMenuBorderLayout::SetExtent(VObject *acv, Point e)
  109. {
  110.     e-= 2*gPoint2 + shadow;
  111.     if (acv->Size() > 1) {
  112.     acv->At(1)->CalcExtent();
  113.     e.y-= acv->At(1)->Height();
  114.     }
  115.     acv->At(0)->SetExtent(e);
  116. }
  117.  
  118. void ETMenuBorderLayout::SetOrigin(VObject *acv, Point at)
  119. {
  120.     at+= gPoint2;
  121.     if (acv->Size() > 1) {
  122.     int x= (acv->Width()-(4+shadow)-acv->At(1)->Width())/2;
  123.     acv->At(1)->SetOrigin(Point(at.x+x, at.y));
  124.     at.y+= acv->At(1)->Height();
  125.     }
  126.     acv->At(0)->SetOrigin(at);
  127. }
  128.  
  129. void ETMenuBorderLayout::Adorn(VObject *acv, Rectangle &r, int)
  130. {
  131.     Rectangle rr(acv->contentRect);
  132.  
  133.     rr.extent-= shadow;
  134.     
  135.     GrPaintRect(rr, gET->backgroundColor);
  136.     if (! acv->At(0)->contentRect.ContainsRect(r)) {
  137.     Ink *pat= shadow == 1 ? ePatBlack : ePatGrey50;
  138.     GrPaintRect(Rectangle(rr.origin.x+rr.extent.x, rr.origin.y+shadow, shadow, rr.extent.y), pat);
  139.     GrPaintRect(Rectangle(rr.origin.x+shadow, rr.origin.y+rr.extent.y, rr.extent.x, shadow), pat);
  140.     
  141.     GrSetPenNormal();
  142.     GrStrokeRect(rr);
  143.     if (acv->Size() > 1) {
  144.         Rectangle cr(r);
  145.         cr.extent-= shadow;
  146.         cr.extent.y= acv->At(1)->Height();
  147.         cr= cr.Inset(2);
  148.         if (GrHasColor())
  149.         GrPaintRect(cr, gET->menuTitleColor);
  150.         acv->At(1)->DrawAll(r);
  151.         if (!GrHasColor())
  152.         GrPaintRect(cr, gET->menuTitleColor);
  153.     }
  154.     }
  155.     acv->At(0)->DrawAll(r);
  156. }
  157.  
  158. //---- ETMenuLineLayout --------------------------------------------------------
  159.  
  160. class ETMenuLineLayout : public Layout {
  161. public:
  162.     ETMenuLineLayout()
  163.     { }
  164.     Metric GetMinSize(VObject*)
  165.     { return gPoint1; }
  166.     void Adorn(VObject *acv, Rectangle&, int)
  167.     { GrPaintRect(acv->contentRect, ePatGrey50); }
  168. };
  169.  
  170. //---- ETScrollButtonLayout ----------------------------------------------------
  171.  
  172. class ETScrollButtonLayout : public Layout {
  173. public:
  174.     ETScrollButtonLayout()
  175.     { }
  176.     Metric GetMinSize(VObject*)
  177.     { return 16 + gPoint4; }
  178.     void Adorn(VObject *acv, Rectangle &r, int code);
  179. };
  180.  
  181. void ETScrollButtonLayout::Adorn(VObject*, Rectangle &r, int code)
  182. {
  183.     GrShowBitMap(r.Inset(2), gET->arrows[code & 0x03]);
  184.     if (TESTBIT(code, 4))
  185.     GrPaintBitMap(r.Inset(2), gET->invarrows[code & 0x03], gHighlightColor);
  186. }
  187.  
  188. //---- ETToggleButtonLayout ----------------------------------------------------
  189.  
  190. class ETToggleButtonLayout : public Layout {
  191.     Bitmap *on, *off, *highlight;
  192. public:
  193.     ETToggleButtonLayout(Bitmap *b1, Bitmap *b2, Bitmap *b3)
  194.     { on= b1; off= b2; highlight= b3; }
  195.     Metric GetMinSize(VObject *acv);
  196.     void Adorn(VObject *acv, Rectangle &r, int code);
  197.     void SetOrigin(VObject *acv, Point at);
  198. };
  199.  
  200. Metric ETToggleButtonLayout::GetMinSize(VObject *acv)
  201. {
  202.     Metric m(on->Size(), 12);
  203.     if (acv->Size() > 0)
  204.     m= HCat(m, acv->At(0)->GetMinSize(), 6);
  205.     return m;
  206. }
  207.  
  208. void ETToggleButtonLayout::SetOrigin(VObject *acv, Point at)
  209. {
  210.     if (acv->Size() > 0) {
  211.     at.x+= on->Size().x+6;
  212.     acv->At(0)->SetOrigin(at);
  213.     }
  214. }
  215.  
  216. void ETToggleButtonLayout::Adorn(VObject *acv, Rectangle &r, int code)
  217. {
  218.     Rectangle rr(acv->GetOrigin(), on->Size());
  219.     
  220.     if (acv->Size() > 0) {
  221.     acv->At(0)->DrawAll(r);
  222.     rr.origin.y+= GetMinSize(acv).base - 12;
  223.     }
  224.  
  225.     if (TESTBIT(code, 3))
  226.     GrPaintBitMap(rr, highlight, gHighlightColor);
  227.     GrPaintBitMap(rr, TESTBIT(code, 1) ? on : off,
  228.               TESTBIT(code, 2) ? ePatBlack : gET->disableInk);
  229. }
  230.  
  231. //---- ETMenuItemLayout ------------------------------------------------------
  232.  
  233. class ETMenuItemLayout : public Layout {
  234. public:
  235.     ETMenuItemLayout()
  236.     { }
  237.     Metric GetMinSize(VObject *acv);
  238.     void SetOrigin(VObject *acv, Point at);
  239.     void Adorn(VObject *acv, Rectangle &r, int code);
  240. };
  241.  
  242. Metric ETMenuItemLayout::GetMinSize(VObject *acv)
  243. {
  244.     Metric m= acv->At(0)->GetMinSize();
  245.     m.extent.x+= 2+gET->CheckMark->Size().x+4+11;
  246.     return m;
  247. }
  248.  
  249. void ETMenuItemLayout::SetOrigin(VObject *acv, Point at)
  250. {
  251.     if (acv->Size() > 0) {
  252.     at.x+= 2+gET->CheckMark->Size().x+4;
  253.     acv->At(0)->SetOrigin(at);
  254.     }
  255. }
  256.  
  257. void ETMenuItemLayout::Adorn(VObject *acv, Rectangle &r, int code)
  258. {
  259.     Rectangle cr(acv->contentRect),
  260.           rr(cr.origin, gET->CheckMark->Size());
  261.  
  262.     Ink *ink= TESTBIT(code, 5) ? ePatBlack : gET->disableInk;
  263.  
  264.     if (TESTBIT(code, 3) && GrHasColor())
  265.     GrPaintRect(cr, gHighlightColor);
  266.  
  267.     if (acv->Size() > 0)
  268.     acv->At(0)->DrawAll(r);
  269.     
  270.     if (TESTBIT(code, 4)) {
  271.     Rectangle rr(gET->menuArrow->Size());
  272.     rr.origin= cr.NE()-Point(11,-4);
  273.     GrPaintBitMap(rr, gET->menuArrow, ink);
  274.     }
  275.  
  276.     if ((code & 3) && TESTBIT(code, 2)) {
  277.     rr.origin.x+= 2;
  278.     rr.origin.y+= (cr.extent.y-gET->CheckMark->Size().y)/2;
  279.     GrPaintBitMap(rr, gET->CheckMark, ink);
  280.     }
  281.  
  282.     if (TESTBIT(code, 3) && !GrHasColor())
  283.     GrPaintRect(cr, gHighlightColor);
  284. }
  285.  
  286. //---- ETScrollBarLayout -------------------------------------------------------
  287.  
  288. class ETScrollBarLayout : public Layout {
  289. public:
  290.     ETScrollBarLayout()
  291.     { }
  292.     void Adorn(VObject *acv, Rectangle &r, int code);
  293. };
  294.  
  295. void ETScrollBarLayout::Adorn(VObject *acv, Rectangle &r, int)
  296. {
  297.     ((Expander*)acv)->Expander::Draw(r);
  298.     GrSetPenNormal();
  299.     GrStrokeRect(r);
  300.     GrSetPenNormal();
  301. }
  302.  
  303. //---- ETActionButtonLayout ----------------------------------------------------
  304.  
  305. class ETActionButtonLayout : public Layout {
  306.     Point border;
  307.     bool dflt;
  308. public:
  309.     ETActionButtonLayout(bool d)
  310.     { dflt= d; }
  311.     void Adorn(VObject *acv, Rectangle &r, int code);
  312.     Metric GetMinSize(VObject *acv)
  313.     { return acv->At(0)->GetMinSize().Expand(gPoint6); }
  314. };
  315.  
  316. void ETActionButtonLayout::Adorn(VObject *acv, Rectangle &r, int code)
  317. {
  318.     Rectangle rr(r.Inset(4));
  319.     VObject *vop= acv->At(0);
  320.  
  321.     if (! TESTBIT(code, 2))
  322.     GrSetPenInk(gET->disableInk);
  323.  
  324.     if (GrHasColor() && (TESTBIT(code, 1) || TESTBIT(code, 3)))
  325.     GrPaintRoundRect(rr, 14, gHighlightColor);
  326.     
  327.     vop->DrawAll(r);
  328.     
  329.     if (!GrHasColor() && (TESTBIT(code, 1) || TESTBIT(code, 3)))
  330.     GrPaintRoundRect(rr, 14, gHighlightColor);
  331.  
  332.     GrStrokeRoundRect(rr, 14);
  333.     if (dflt) {
  334.     GrSetPenSize(2);
  335.     GrStrokeRoundRect(r, 18);
  336.     }
  337.     GrSetPenNormal();
  338. }
  339.     
  340. //---- ETPopupButtonLayout -----------------------------------------------------
  341.  
  342. class ETPopupButtonLayout : public Layout {
  343. public:
  344.     ETPopupButtonLayout()
  345.     { }
  346.     void Adorn(VObject *acv, Rectangle &r, int code);
  347. };
  348.  
  349. void ETPopupButtonLayout::Adorn(VObject *acv, Rectangle&, int)
  350. {
  351.     Rectangle rr(acv->contentRect);
  352.     rr.extent-= gPoint1;
  353.     rr.origin+= gPoint1;
  354.     GrPaintLine(gET->shadowColor, 1, eDefaultCap, rr.SW(), rr.SE());
  355.     GrPaintLine(gET->shadowColor, 1, eDefaultCap, rr.NE(), rr.SE());
  356.     rr.origin-= gPoint1;
  357.     GrStrokeRect(rr);
  358. }
  359.  
  360. //---- ETSliderLayout ----------------------------------------------------------
  361.  
  362. class ETSliderLayout : public Layout {
  363. public:
  364.     ETSliderLayout()
  365.     { }
  366.     void Adorn(VObject *acv, Rectangle &r, int code);
  367. };
  368.  
  369. void ETSliderLayout::Adorn(VObject*, Rectangle &r, int)
  370. {
  371.     GrPaintRect(r, ePatGrey12);
  372.     GrSetPenNormal();
  373.     GrStrokeRect(r);
  374. }
  375.  
  376. //---- ETThumbLayout -----------------------------------------------------------
  377.  
  378. class ETThumbLayout : public Layout {
  379. public:
  380.     ETThumbLayout()
  381.     { }
  382.     Metric GetMinSize(VObject*)
  383.     { return Metric(20); }
  384.     void Adorn(VObject *acv, Rectangle &r, int code);
  385. };
  386.  
  387. void ETThumbLayout::Adorn(VObject*, Rectangle &r, int)
  388. {
  389.     GrPaintRect(r, ePatGrey50);
  390.     GrStrokeRect(r);
  391. }
  392.  
  393. //---- ETFieldBorderLayout --------------------------------------------------
  394.  
  395. class ETFieldBorderLayout : public Layout {
  396.     bool noborder;
  397. public:
  398.     ETFieldBorderLayout(bool nb)
  399.     { noborder= nb; }
  400.     void Adorn(VObject *acv, Rectangle &r, int code);
  401.     long GetValue(VObject*, int)
  402.     { return noborder ? 1 : 2; }
  403. };
  404.  
  405. void ETFieldBorderLayout::Adorn(VObject *acv, Rectangle&, int code)
  406. {
  407.     int bw= 1;
  408.     if (noborder) {
  409.     if (!code)
  410.         bw= 0;
  411.     } else {
  412.     if (code)
  413.         bw= 2;
  414.     }
  415.     if (bw > 0)
  416.     GrGetPort()->StrokeRect(gInkBlack, bw, acv->contentRect);
  417. }
  418.  
  419. //---- ETMenuBarLayout ---------------------------------------------------------
  420.  
  421. class ETMenuBarLayout : public Layout {
  422. public:
  423.     ETMenuBarLayout()
  424.     { }
  425.     Metric GetMinSize(VObject *acv)
  426.     { return acv->At(0)->GetMinSize().Expand(gPoint1); }
  427.     void SetOrigin(VObject *acv, Point at)
  428.     { acv->At(0)->SetOrigin(at+gPoint1); }
  429.     void SetExtent(VObject *acv, Point e)
  430.     { acv->At(0)->SetExtent(e-gPoint2); }
  431.     void Adorn(VObject *acv, Rectangle&, int)
  432.     { GrStrokeRect(acv->contentRect); }
  433. };
  434.  
  435. //---- ETProgressBarLayout -----------------------------------------------------
  436.  
  437. class ETProgressBarLayout : public Layout {
  438. public:
  439.     ETProgressBarLayout()
  440.     { }
  441.     Metric GetMinSize(VObject*)
  442.     { return Metric(200, 20); }
  443.     void Adorn(VObject *acv, Rectangle &r, int code);
  444. };
  445.  
  446. void ETProgressBarLayout::Adorn(VObject *acv, Rectangle&, int val)
  447. {
  448.     Rectangle rr(acv->contentRect);
  449.     rr.extent.x= val;
  450.     GrPaintRect(rr, ePatGrey50);
  451.     GrStrokeRect(acv->contentRect);
  452. }
  453.  
  454. //---- ETScaleLayout -----------------------------------------------------------
  455.  
  456. class ETScaleLayout : public Layout {
  457. public:
  458.     ETScaleLayout()
  459.     { }
  460.     Metric GetMinSize(VObject *acv)
  461.     { return acv->At(0)->GetMinSize(); }
  462.     void Adorn(VObject *acv, Rectangle &r, int code);
  463. };
  464.  
  465. void ETScaleLayout::Adorn(VObject *acv, Rectangle&, int)
  466. {
  467.     Rectangle cr= acv->contentRect;
  468.     GrStrokeRect(cr);
  469. }
  470.  
  471. //---- ETFrameLayout -----------------------------------------------------------
  472.  
  473. class ETFrameLayout : public Layout {
  474. public:
  475.     ETFrameLayout()
  476.     { }
  477.     void Adorn(VObject *acv, Rectangle &r, int code);
  478.     long GetValue(VObject*, int code)
  479.     { return code ? -1 : 1; }
  480. };
  481.  
  482. void ETFrameLayout::Adorn(VObject*, Rectangle &r, int)
  483. {
  484.     GrStrokeRect(r.Expand(gPoint1));
  485. }
  486.  
  487. //---- ETScaleThumbLayout ------------------------------------------------------
  488.  
  489. class ETScaleThumbLayout : public Layout {
  490.     Direction dir;
  491. public:
  492.     ETScaleThumbLayout(Direction d)
  493.     { dir= d; }
  494.     Metric GetMinSize(VObject *acv);
  495.     void Adorn(VObject *acv, Rectangle &r, int code);
  496. };
  497.  
  498. Metric ETScaleThumbLayout::GetMinSize(VObject*)
  499. {
  500.     if (dir == eHor)
  501.     return Metric(20, 15);
  502.     return Metric(15, 20);
  503. }
  504.  
  505. void ETScaleThumbLayout::Adorn(VObject *acv, Rectangle&, int)
  506. {
  507.     GrPaintRect(acv->contentRect, ePatGrey50);
  508.     GrStrokeRect(acv->contentRect);
  509. }
  510.  
  511. //---- ETGroupLayout -----------------------------------------------------------
  512.  
  513. class ETGroupLayout : public Layout {
  514.     Point border;
  515.     int cBorderTitleGap;
  516. public:
  517.     ETGroupLayout()
  518.     { border= gPoint6; cBorderTitleGap= 4; }
  519.     void SetOrigin(VObject*, Point);
  520.     void SetExtent(VObject*, Point);
  521.     Metric GetMinSize(VObject *acv);
  522.     void Adorn(VObject *acv, Rectangle &r, int code);
  523. };
  524.  
  525. Metric ETGroupLayout::GetMinSize(VObject *acv)
  526. {
  527.     VObject *interior= acv->At(0);
  528.     Metric m= interior->GetMinSize();
  529.     
  530.     if (acv->Size() > 1) {
  531.     VObject *titleBar= acv->At(1);
  532.     Metric tm= titleBar->GetMinSize();
  533.     m.extent.x= Math::Max(m.extent.x, tm.extent.x+2*cBorderTitleGap);
  534.     int d= tm.extent.y - border.y;
  535.     if (d > 0) {
  536.         m.extent.y+= d;
  537.         m.base+= d;
  538.     }
  539.     }
  540.     return m.Expand(border);
  541. }
  542.  
  543. void ETGroupLayout::SetExtent(VObject *acv, Point e)
  544. {
  545.     if (acv->Size() > 1) {
  546.     VObject *titleBar= acv->At(1);
  547.     titleBar->CalcExtent();
  548.     int d= titleBar->Height() - border.y;
  549.     if (d > 0)
  550.         e.y-= d;
  551.     }
  552.     acv->At(0)->SetExtent(e-2*border);
  553. }
  554.  
  555. void ETGroupLayout::SetOrigin(VObject *acv, Point at)
  556. {
  557.     if (acv->Size() > 1) {
  558.     VObject *titleBar= acv->At(1);
  559.     int th= titleBar->Height();
  560.     int tgap= border.x+cBorderTitleGap;
  561.     titleBar->Align(Point(at.x+tgap, at.y), Metric(acv->Width()-2*tgap, th),
  562.                 (VObjAlign)((eVObjHLeft & eVObjH) | eVObjVTop));
  563.     int d= th - border.y;
  564.     if (d > 0)
  565.         at.y+= d;
  566.     }
  567.     acv->At(0)->SetOrigin(at+border);
  568. }
  569.  
  570. void ETGroupLayout::Adorn(VObject *acv, Rectangle &r, int)
  571. {
  572.     if (! acv->At(0)->contentRect.ContainsRect(r)) {
  573.     if (acv->Size() > 1) {
  574.         VObject *titleBar= acv->At(1);
  575.         int h= titleBar->Height()/2-1;
  576.         Rectangle rr(acv->contentRect);
  577.         rr.origin.y+= h;
  578.         rr.extent.y-= h;
  579.  
  580.         GrLine(Point(titleBar->GetOrigin().x, rr.origin.y), rr.NW());
  581.         GrLine(rr.NW(), rr.SW());
  582.         GrLine(rr.SW(), rr.SE());
  583.         GrLine(rr.SE(), rr.NE());
  584.         GrLine(rr.NE(), Point(titleBar->contentRect.NE().x, rr.origin.y));
  585.     } else
  586.         GrStrokeRect(acv->contentRect);
  587.     }
  588. }
  589.  
  590. //---- ET++ --------------------------------------------------------------------
  591.  
  592. ETLook::ETLook()
  593. {
  594.     gET= this;
  595.     
  596.     if (gDepth > 1) {
  597.     shadowColor= new_Grey(0.5);
  598.     menuTitleColor= new_Grey(230);
  599.     windowHighlightColor= new_Grey(0.8);
  600.     } else {
  601.     shadowColor= ePatGrey50;
  602.     menuTitleColor= gInkXor;
  603.     windowHighlightColor= gInkXor;
  604.     }
  605.     
  606.     arrows[0]= new Bitmap(16, UpArrowBits, 1);
  607.     arrows[1]= new Bitmap(16, DownArrowBits, 1);
  608.     arrows[2]= new Bitmap(16, LeftArrowBits, 1);
  609.     arrows[3]= new Bitmap(16, RightArrowBits, 1);
  610.     invarrows[0]= new Bitmap(16, InvUpArrowBits, 1);
  611.     invarrows[1]= new Bitmap(16, InvDownArrowBits, 1);
  612.     invarrows[2]= new Bitmap(16, InvLeftArrowBits, 1);
  613.     invarrows[3]= new Bitmap(16, InvRightArrowBits, 1);
  614.     menuArrow= new Bitmap(11, menuArrowBits, 1);
  615.  
  616.     Point s(14, 13);
  617.     radioButtonOn= new Bitmap(s, RadioButtonOnBits);
  618.     radioButtonOff= new Bitmap(s, RadioButtonOffBits);
  619.     radioButtonFeedback= new Bitmap(s, RadioButtonFeedbackBits);
  620.  
  621.     CheckMark= new Bitmap(Point(14,12), CheckMarkBits);
  622.  
  623.     CheckMarkOn= new Bitmap(s, CheckMarkOnBits);
  624.     CheckMarkOff= new Bitmap(s, CheckMarkOffBits);
  625.     CheckMarkFeedback= new Bitmap(s, CheckMarkFeedbackBits);
  626.  
  627.     StretchBoxNW= new Bitmap(8, StretchBoxNWBits);
  628.     StretchBoxNE= new Bitmap(8, StretchBoxNEBits);
  629.     StretchBoxSW= new Bitmap(8, StretchBoxSWBits);
  630.     StretchBoxSE= new Bitmap(8, StretchBoxSEBits);
  631.     
  632.     popUpMenuLayout= new ETMenuBorderLayout(5);
  633.     pullDownMenuLayout= new ETMenuBorderLayout(1);
  634.     menuLineLayout= new ETMenuLineLayout;
  635.     menuItemLayout= new ETMenuItemLayout;
  636.     scrollButtonLayout= new ETScrollButtonLayout;
  637.     
  638.     toggleButtonLayout= new ETToggleButtonLayout(CheckMarkOn, CheckMarkOff, CheckMarkFeedback);
  639.     radioButtonLayout= new ETToggleButtonLayout(radioButtonOn, radioButtonOff, radioButtonFeedback);
  640.     scrollBarLayout= new ETScrollBarLayout;
  641.     actionButtonLayout= new ETActionButtonLayout(FALSE);
  642.     defaultButtonLayout= new ETActionButtonLayout(TRUE);
  643.     popupButtonLayout= new ETPopupButtonLayout;
  644.     sliderLayout= new ETSliderLayout;
  645.     thumbLayout= new ETThumbLayout;
  646.     fieldBorderLayout= new ETFieldBorderLayout(FALSE);
  647.     fieldLayout= new ETFieldBorderLayout(TRUE);
  648.     menuBarLayout= new ETMenuBarLayout;
  649.     progressBarLayout= new ETProgressBarLayout;
  650.     scaleLayout= new ETScaleLayout;
  651.     scaleThumbLayout[eHor]= new ETScaleThumbLayout(eHor);
  652.     scaleThumbLayout[eVert]= new ETScaleThumbLayout(eVert);
  653.     groupLayout= new ETGroupLayout;
  654.     frameLayout= new ETFrameLayout;
  655. }
  656.  
  657. ETLook::~ETLook()
  658. {
  659.     for (int i= 0; i < 4; i++) {
  660.     SafeDelete(arrows[i]);
  661.     SafeDelete(invarrows[i]);
  662.     }
  663.     SafeDelete(menuArrow);
  664.     SafeDelete(radioButtonOn);
  665.     SafeDelete(radioButtonOff);
  666.     SafeDelete(radioButtonFeedback);
  667.     SafeDelete(CheckMarkOn);
  668.     SafeDelete(CheckMarkOff);
  669.     SafeDelete(CheckMarkFeedback);
  670.     SafeDelete(CheckMark);
  671.     SafeDelete(StretchBoxNW);
  672.     SafeDelete(StretchBoxNE);
  673.     SafeDelete(StretchBoxSW);
  674.     SafeDelete(StretchBoxSE);
  675. }
  676.  
  677. void ETLook::DrawHighlight(Rectangle &r)
  678. {
  679.     GrPaintRect(r, gHighlightColor);
  680. }
  681.  
  682.